﻿$(document).ready(function () {
    //新增奖励分类
    $("#btnGiftsClassAdd").bind("click", btnGiftsClassAdd);
    //下一步
    $("#btnGiftsClassSave").bind("click", btnGiftsClassSave);
    //奖励的六种类型绑定
    $("#btnScoreClassSave").bind("click", btnScoreClassSave);
    $("#btnMoneyClassSave").bind("click", btnMoneyClassSave);
    $("#btnRebateClassSave").bind("click", btnRebateClassSave);
    $("#btnMoneyRebateClassSave").bind("click", btnMoneyRebateClassSave);
    $("#btnExtendClassSave").bind("click", btnExtendClassSave);
    $("#btnPresentClassSave").bind("click", btnPresentClassSave);
    $("#btnShareClassSave").bind("click", btnShareClassSave);

    //BindNullList("gvwGoodsClass");
})
//修改活动状态
function btnOnOffActivity(ListID, ListType, State) {
    var state = State == 1 ? "开启" : "关闭";
    var oppsite_state = State == 0 ? "开启" : "关闭";
    art.dialog({
        title: "系统提示",
        lock: true,
        content: '该奖励现在是【' + state + '】状态，确定修改为【' + oppsite_state + '】吗? ',
        ok: function () {
            this.lock();
            doAjax("../", "OnOffActivityModel", { "ID": ListID, "Type": ListType }, "json", function (text) {
                if (text == "0") {
                    art.dialog({
                        title: '系统提示',
                        time: 4,
                        content: ("系统异常，未保存数据，请再次点击保存！"),
                        lock: true
                    });
                } else if (text == "-1") {
                    art.dialog
                            ({
                                title: '系统提示',
                                time: 4,
                                content: ("系统错误 请与系统管理员联系！"),
                                lock: true
                            });
                } else {
                    art.dialog({
                        title: '系统提示',
                        time: 0.5,
                        content: '修改成功！',
                        close: function () { window.location.reload(); },
                        lock: true
                    });
                }
            })
            return false;
        },
        cancelVal: '取消',
        cancel: true //为true等价于function(){}
    })
}
function btnGiftsClassAdd() {


    art.dialog({
        lock: true,
        title: '奖励类型新增',
        width: '300',
        content: document.getElementById('dvGoodsClassInfo'),
        id: 'dvGoodsClassInfo',
        close: function () { }
    });
}

function btnGiftsListEdit(ListID, ListType) {
    switch (ListType) {
        case "积分":
            doAjax("../", "GetScoreMoneyModel", { "ID": ListID }, "json", function (json) { EditSwitchSuccessScore(json) });
            break;
        case "储值":
            doAjax("../", "GetScoreMoneyModel", { "ID": ListID }, "json", function (json) { EditSwitchSuccessMoney(json) });
            break;
        case "消费返利":
            doAjax("../", "GetRebateModel", { "ID": ListID }, "json", function (json) { EditSwitchSuccessRebate(json) });
            break;
        case "储值返利":
            doAjax("../", "GetRebateModel", { "ID": ListID }, "json", function (json) { EditSwitchSuccessMoneyRebate(json) });
            break;
        case "推广奖励":
            doAjax("../", "GetShareExtendModel", { "ID": ListID }, "json", function (json) { EditSwitchSuccessExtend(json) });
            break;
        case "分享奖励":
            doAjax("../", "GetShareExtendModel", { "ID": ListID }, "json", function (json) { EditSwitchSuccessShare(json) });
            break;
        case "小礼品":
            doAjax("../", "GetPresentModel", { "ID": ListID }, "json", function (json) { EditSwitchSuccessPresent(json) });
            break;
    }
}

function btnGiftsClassSave() {
    var strErrorMsg = "";
    var radioGiftType = $.trim($("#radioGiftType").val());

    if (radioGiftType == "") { strErrorMsg = "奖励类型不能为空,请选择奖励类型！"; }
    if (strErrorMsg != "") {
        art.dialog({
            title: '系统提示',
            icon: 'error', //图标
            content: strErrorMsg,
            lock: true
        });
        return false;
    }
    //下一步操作，根据不同奖励类型展示不同选项

    switch (radioGiftType) {
        case "积分":
            $("#txtScoreNum").val("");
            art.dialog({
                lock: true,
                title: '【积分】奖励新增',
                width: '300',
                content: document.getElementById('ScorePart'),
                id: 'ScorePart',
                close: function () { $("#txtScoreNum").val(""); }
            });
            break;
        case "储值":
            $("#txtMoneyNum").val("");
            art.dialog({
                lock: true,
                title: '【储值】奖励新增',
                width: '300',
                content: document.getElementById('MoneyPart'),
                id: 'MoneyPart',
                close: function () { $("#txtMoneyNum").val(""); }
            });
            break;
        case "消费返利":
            $("#txtRebateNum1,#txtRebateNum2,#txtRebateNum3,#txtRebateLimit").val("");
            art.dialog({
                lock: true,
                title: '【消费返利】奖励新增',
                width: '300',
                content: document.getElementById('RebatePart'),
                id: 'RebatePart',
                close: function () { $("#txtRebateNum1,#txtRebateNum2,#txtRebateNum3,#txtRebateLimit").val(""); }
            });
            break;
        case "储值返利":
            $("#txtMoneyRebateNum1,#txtMoneyRebateNum2,#txtMoneyRebateNum3,#txtMoneyRebateLimit").val("");
            art.dialog({
                lock: true,
                title: '【储值返利】奖励新增',
                width: '300',
                content: document.getElementById('MoneyRebatePart'),
                id: 'MoneyRebatePart',
                close: function () { $("#txtMoneyRebateNum1,#txtMoneyRebateNum2,#txtMoneyRebateNum3,#txtMoneyRebateLimit").val(""); }
            });
            break;
        case "推广":
            $("#txtExtendNum1,#txtExtendNum2,#txtExtendNum3,#txtExtendLimit").val("");
            art.dialog({
                lock: true,
                title: '【推广】奖励新增',
                width: '300',
                content: document.getElementById('ExtendPart'),
                id: 'ExtendPart',
                close: function () { $("#txtExtendNum1,#txtExtendNum2,#txtExtendNum3,#txtExtendLimit").val(""); }
            });
            break;
        case "分享":
            $("#txtShareScore,#txtShareMoney,#txtSharePocket,#txtShareLimit").val("");
            art.dialog({
                lock: true,
                title: '【分享】奖励新增',
                width: '300',
                content: document.getElementById('SharePart'),
                id: 'SharePart',
                close: function () { $("#txtShareScore,#txtShareMoney,#txtSharePocket,#txtShareLimit").val(""); }
            });
            break;
        case "小礼品":
            $("#txtPresentName,#txtPresentLimit").val("");
            art.dialog({
                lock: true,
                title: '【小礼品】奖励新增',
                width: '300',
                content: document.getElementById('PresentPart'),
                id: 'PresentPart',
                close: function () { $("#txtPresentName,#txtPresentLimit").val(""); }
            });
            break;

    }
}

function btnGiftsListDel(ListID, ListType, ListName) {
    art.dialog({
        title: "系统提示",
        lock: true,
        content: '确定要删除奖励【' + ListName + '】吗? 此操作不可恢复',
        ok: function () {
            this.close();
            doAjax("../", "DelActivityModel", { "ID": ListID, "Type": ListType }, "json", function (text) {
                if (text == "0") {
                    art.dialog
                          ({
                              title: '系统提示',
                              time: 4,
                              content: ("系统异常，未保存数据，请再次点击保存！"),
                              lock: true
                          });

                }
                else if (text == "-2") {
                    art.dialog
                            ({
                                title: '系统提示',
                                time: 4,
                                content: ("系统错误 请与系统管理员联系！"),
                                lock: true
                            });
                }
                else {
                    art.dialog
                           ({
                               title: '系统提示',
                               time: 0.5,
                               content: '删除成功！',
                               close: function () { window.location.reload(); },
                               lock: true
                           });
                }
            });
            return false;
        },
        cancelVal: '取消',
        cancel: true //为true等价于function(){}
    });
    return false;
}

//六种奖励的保存按钮

//积分添加及修改
function btnScoreClassSave() {
    var txtScoreID = $.trim($("#txtScoreID").val());
    var txtScoreNum = $.trim($("#txtScoreNum").val());
    var strErrorMsg = "";
    if (txtScoreNum == "" || !isIntPositive(txtScoreNum)) { strErrorMsg += "<li> 请填写奖励积分数量(正整数)</li>"; }
    if (!IsError(strErrorMsg)) {
        return false;
    }
    var type = txtScoreID != "" && txtScoreID != "undefined" ? "ScoreEdit" : "CreateScore";
    doAjax("../", type, { "num": txtScoreNum, "ID": txtScoreID }, "text", function (text) { successg(text); })
}
//储值
function btnMoneyClassSave() {
    var txtMoneyID = $.trim($("#txtMoneyID").val());
    var txtMoneyNum = $.trim($("#txtMoneyNum").val());
    var strErrorMsg = "";
    if (txtMoneyNum == "" || !IsMoney(txtMoneyNum)) { strErrorMsg += "<li> 请填写奖励储值数量(正整数)</li>"; }

    if (!IsError(strErrorMsg)) {
        return false;
    }
    var type = txtMoneyID != "" && txtMoneyID != "undefined" ? "MoneyEdit" : "CreateMoney";
    doAjax("../", type, { "num": txtMoneyNum, "ID": txtMoneyID }, "text", function (text) { successg(text); })

}
//消费返利
function btnRebateClassSave() {

    var txtRebateID = $.trim($("#txtRebateID").val());
    var txtRebateNum1 = $.trim($("#txtRebateNum1").val());
    var txtRebateNum2 = $.trim($("#txtRebateNum2").val());
    var txtRebateNum3 = $.trim($("#txtRebateNum3").val());
    var txtRebateLimit = $.trim($("#txtRebateLimit").val());

    var strErrorMsg = "";
    if (txtRebateNum1 == "" || !IsMoney(txtRebateNum1)) { strErrorMsg += "<li> 请填写一级返利率</li>"; }
    if (txtRebateNum2 != "" && !IsMoney(txtRebateNum2)) { strErrorMsg += "<li> 请重新填写二级返利率(正整数)</li>"; }
    if (txtRebateNum3 != "" && !IsMoney(txtRebateNum3)) { strErrorMsg += "<li> 请重新填写三级返利率(正整数)</li>"; }
    if (txtRebateLimit == "" || !IsMoney(txtRebateLimit)) { strErrorMsg += "<li> 请填写有效期(正整数)</li>"; }
    if (!IsError(strErrorMsg)) {
        return false;
    }
    var type = txtRebateID != "" && txtRebateID != "undefined" ? "RebateEdit" : "CreateRebate";
    doAjax("../", type, { "RebateNum1": txtRebateNum1, "RebateNum2": txtRebateNum2, "RebateNum3": txtRebateNum3, "RebateLimit": txtRebateLimit, "ID": txtRebateID }, "text", function (text) { successg(text); })
}
//储值返利
function btnMoneyRebateClassSave() {

    var txtMoneyRebateID = $.trim($("#txtMoneyRebateID").val());
    var txtMoneyRebateNum1 = $.trim($("#txtMoneyRebateNum1").val());
    var txtMoneyRebateNum2 = $.trim($("#txtMoneyRebateNum2").val());
    var txtMoneyRebateNum3 = $.trim($("#txtMoneyRebateNum3").val());
    var txtMoneyRebateLimit = $.trim($("#txtMoneyRebateLimit").val());

    var strErrorMsg = "";
    if (txtMoneyRebateNum1 == "" || !IsMoney(txtMoneyRebateNum1)) { strErrorMsg += "<li> 请填写一级返利率</li>"; }
    if (txtMoneyRebateNum2 != "" && !IsMoney(txtMoneyRebateNum2)) { strErrorMsg += "<li> 请重新填写二级返利率(正整数)</li>"; }
    if (txtMoneyRebateNum3 != "" && !IsMoney(txtMoneyRebateNum3)) { strErrorMsg += "<li> 请重新填写三级返利率(正整数)</li>"; }
    if (txtMoneyRebateLimit == "" || !IsMoney(txtMoneyRebateLimit)) { strErrorMsg += "<li> 请填写有效期(正整数)</li>"; }
    if (!IsError(strErrorMsg)) {
        return false;
    }
    var type = txtMoneyRebateID != "" && txtMoneyRebateID != "undefined" ? "RebateEdit" : "CreateMoneyRebate";
    doAjax("../", type, { "RebateNum1": txtMoneyRebateNum1, "RebateNum2": txtMoneyRebateNum2, "RebateNum3": txtMoneyRebateNum3, "RebateLimit": txtMoneyRebateLimit, "ID": txtMoneyRebateID }, "text", function (text) { successg(text); })
}
//推广
function btnExtendClassSave() {
    var txtExtendID = $.trim($("#txtExtendID").val());
    var txtExtendScore = $.trim($("#txtExtendScore").val());
    var txtExtendMoney = $.trim($("#txtExtendMoney").val());
    var txtExtendPocket = $.trim($("#txtExtendPocket").val());
    var txtExtendLimit = $.trim($("#txtExtendLimit").val());
    var txtExtendLimitValidity = $.trim($("#txtExtendLimitValidity").val());

    var strErrorMsg = "";
    if (txtExtendScore == "" && txtExtendMoney == "" ) { strErrorMsg += "<li>积分数量、储值金额，最少填写一个</li>"; }
    //if (txtExtendScore == "" && txtExtendMoney == "" && txtExtendPocket) { strErrorMsg += "<li>积分数量、储值金额、微信红包，最少填写一个</li>"; }
    //if (txtExtendLimit == "" || !IsMoney(txtExtendLimit)) { strErrorMsg += "<li> 请填写频率限制</li>"; }
    if (txtExtendScore != "" && !isIntPositive(txtExtendScore)) { strErrorMsg += "<li> 请重新填写积分(正整数)</li>"; }
    if (txtExtendMoney != "" && !IsMoney(txtExtendMoney)) { strErrorMsg += "<li> 请重新填写储值(正整数)</li>"; }

    if (txtExtendLimitValidity == "" || !IsMoney(txtExtendLimitValidity)) { strErrorMsg += "<li> 请填写有效期(正整数)</li>"; }
    if (!IsError(strErrorMsg)) {
        return false;
    }
    var type = txtExtendID != "" && txtExtendID != "undefined" ? "ExtendEdit" : "CreateExtend";
    doAjax("../", type, { "txtExtendScore": txtExtendScore, "txtExtendMoney": txtExtendMoney, "txtExtendPocket": txtExtendPocket, "txtExtendLimit": txtExtendLimit, "txtExtendLimitValidity": txtExtendLimitValidity, "ID": txtExtendID }, "text", function (text) { successg(text); })

}
//分享
function btnShareClassSave() {

    var txtShareID = $.trim($("#txtShareID").val());
    var txtShareScore = $.trim($("#txtShareScore").val());
    var txtShareMoney = $.trim($("#txtShareMoney").val());
    var txtSharePocket = $.trim($("#txtSharePocket").val());
    var txtShareLimit = $.trim($("#txtShareLimit").val());
    var txtShareLimitValidity = $.trim($("#txtShareLimitValidity").val());
    
    var strErrorMsg = "";
    if (txtShareScore == "" && txtShareMoney == "" && txtSharePocket=="") { strErrorMsg += "<li>积分数量、储值金额、微信红包，最少填写一个</li>"; }
    if (txtShareScore != "" && !isIntPositive(Number(txtShareScore))) { strErrorMsg += "<li> 请重新填写积分(正整数)</li>"; }
    if (txtShareMoney != "" && !IsMoney(Number(txtShareMoney))) { strErrorMsg += "<li> 请重新填写储值(正整数)</li>"; }
if (txtSharePocket != "" && !IsMoney(Number(txtSharePocket))) { strErrorMsg += "<li> 请重新填写红包(正整数)</li>"; }
    if (txtSharePocket != "" && Number(txtSharePocket) < 1) {

        strErrorMsg += "<li> 请重新填写红包(红包金额要求大于等于1)</li>";
    }

    if (txtShareLimit == "" || !IsMoney(txtShareLimit)) { strErrorMsg += "<li> 请填写频率限制(正整数)</li>"; }
    if (txtShareLimitValidity == "" || !IsMoney(txtShareLimitValidity)) { strErrorMsg += "<li> 请填写有效期(正整数)</li>"; }
    if (!IsError(strErrorMsg)) {
        return false;
    }
    var type = txtShareID != "" && txtShareID != "undefined" ? "ShareEdit" : "CreateShare";
    doAjax("../", type, { "txtShareScore": txtShareScore, "txtShareMoney": txtShareMoney, "txtSharePocket": txtSharePocket, "txtShareLimit": txtShareLimit, "txtShareLimitValidity": txtShareLimitValidity, "ID": txtShareID }, "text", function (text) { successg(text); })
}
//小礼品
function btnPresentClassSave() {
    var txtPresentID = $.trim($("#txtPresentID").val());
    var txtPresentName = $.trim($("#txtPresentName").val());
    var txtPresentLimit = $.trim($("#txtPresentLimit").val());

    var strErrorMsg = "";
    if (txtPresentName == "") { strErrorMsg += "<li>请填写礼品名称</li>"; }
    if (txtPresentLimit == "" || !IsMoney(txtPresentLimit)) { strErrorMsg += "<li> 请填写有效期(正整数)</li>"; }
    if (!IsError(strErrorMsg)) {
        return false;
    }
    var type = txtPresentID != "" && txtPresentID != "undefined" ? "PresentEdit" : "CreatePresent";
    doAjax("../", type, { "txtPresentName": txtPresentName, "txtPresentLimit": txtPresentLimit, "ID": txtPresentID }, "text", function (text) { successg(text); })

}
function IsError(strErrorMsg) {
    if (strErrorMsg != "") {
        strErrorMsg = "<div>操作出现以下错误，请核查后重试！</div><ul>" + strErrorMsg + "</ul>";
        art.dialog({
            title: '系统提醒',
            icon: 'error', //图标
            content: strErrorMsg,
            lock: true
        });
        return false;
    }
    return true;

}

//=========================================success==================================================
function successg(text) {
    if (text == "0") {
        art.dialog({
            title: '系统提示',
            time: 4,
            content: ("系统异常，未保存数据，请再次点击保存！"),
            lock: true
        });
    }
    else if (text == "-1") {
        art.dialog
               ({
                   title: '系统提示',
                   time: 4,
                   content: ("系统错误 操作失败！"),
                   lock: true
               });
    }
    else {
        art.dialog({
            title: '系统提示',
            time: 0.5,
            content: '保存成功！',
            close: function () { window.location.reload(); },
            lock: true
        });
    }
}

function EditSwitchSuccessScore(json) {
    switch (json) {
        case "0":
            art.dialog
                   ({
                       title: '系统提示',
                       content: ("系统异常，未保存数据，请再次点击保存！"),
                       lock: true
                   });
            break;
        case "-1":
            art.dialog
                   ({
                       title: '系统提示',
                       content: ("未找到此分类，请刷新重试！"),
                       lock: true
                   });
            break;
        case "-3":
            art.dialog
                   ({
                       title: '系统提示',
                       content: ("系统错误 请与系统管理员联系！"),
                       lock: true
                   });
            break;
        default:
            $("#txtScoreID").val(json.ScoreMoneyModel.ID);
            $("#txtScoreNum").val(json.ScoreMoneyModel.Nums);
            art.dialog({
                lock: true,
                title: '【积分】奖励修改',
                width: '300',
                content: document.getElementById('ScorePart'),
                id: 'ScorePart',
                close: function () { $("#txtScoreNum,#txtScoreID").val(""); }
            });
            break;
    }
}
function EditSwitchSuccessMoney(json) {
    switch (json) {
        case "0":
            art.dialog
                   ({
                       title: '系统提示',
                       content: ("系统异常，未保存数据，请再次点击保存！"),
                       lock: true
                   });
            break;
        case "-1":
            art.dialog
                   ({
                       title: '系统提示',
                       content: ("未找到此分类，请刷新重试！"),
                       lock: true
                   });
            break;
        case "-3":
            art.dialog
                   ({
                       title: '系统提示',
                       content: ("系统错误 请与系统管理员联系！"),
                       lock: true
                   });
            break;
        default:
            $("#txtMoneyID").val(json.ScoreMoneyModel.ID);
            $("#txtMoneyNum").val(json.ScoreMoneyModel.Nums);
            art.dialog({
                lock: true,
                title: '【储值】奖励修改',
                width: '300',
                content: document.getElementById('MoneyPart'),
                id: 'MoneyPart',
                close: function () { $("#txtMoneyNum,#txtMoneyID").val(""); }
            });
            break;
    }
}
function EditSwitchSuccessRebate(json) {
    switch (json) {
        case "0":
            art.dialog
                   ({
                       title: '系统提示',
                       content: ("系统异常，未保存数据，请再次点击保存！"),
                       lock: true
                   });
            break;
        case "-1":
            art.dialog
                   ({
                       title: '系统提示',
                       content: ("未找到此分类，请刷新重试！"),
                       lock: true
                   });
            break;
        case "-3":
            art.dialog
                   ({
                       title: '系统提示',
                       content: ("系统错误 请与系统管理员联系！"),
                       lock: true
                   });
            break;
        default:
            $("#txtRebateID").val(json.RebateModel.ID);
            $("#txtRebateNum1").val(json.RebateModel.Level1);
            $("#txtRebateNum2").val(json.RebateModel.Level2);
            $("#txtRebateNum3").val(json.RebateModel.Level3);
            $("#txtRebateLimit").val(json.RebateModel.Validity);
            art.dialog({
                lock: true,
                title: '【消费返利】奖励修改',
                width: '300',
                content: document.getElementById('RebatePart'),
                id: 'RebatePart',
                close: function () { $("#txtRebateNum1,#txtRebateNum2,#txtRebateNum3,#txtRebateLimit").val(""); }
            });
            break;
    }
}
function EditSwitchSuccessMoneyRebate(json) {
    switch (json) {
        case "0":
            art.dialog
                   ({
                       title: '系统提示',
                       content: ("系统异常，未保存数据，请再次点击保存！"),
                       lock: true
                   });
            break;
        case "-1":
            art.dialog
                   ({
                       title: '系统提示',
                       content: ("未找到此分类，请刷新重试！"),
                       lock: true
                   });
            break;
        case "-3":
            art.dialog
                   ({
                       title: '系统提示',
                       content: ("系统错误 请与系统管理员联系！"),
                       lock: true
                   });
            break;
        default:
            $("#txtMoneyRebateID").val(json.RebateModel.ID);
            $("#txtMoneyRebateNum1").val(json.RebateModel.Level1);
            $("#txtMoneyRebateNum2").val(json.RebateModel.Level2);
            $("#txtMoneyRebateNum3").val(json.RebateModel.Level3);
            $("#txtMoneyRebateLimit").val(json.RebateModel.Validity);
            art.dialog({
                lock: true,
                title: '【储值返利】奖励修改',
                width: '300',
                content: document.getElementById('MoneyRebatePart'),
                id: 'MoneyRebatePart',
                close: function () { $("#txtMoneyRebateNum1,#txtMoneyRebateNum2,#txtMoneyRebateNum3,#txtMoneyRebateLimit").val(""); }
            });
            break;
    }
}
function EditSwitchSuccessExtend(json) {
    switch (json) {
        case "0":
            art.dialog
                   ({
                       title: '系统提示',
                       content: ("系统异常，未保存数据，请再次点击保存！"),
                       lock: true
                   });
            break;
        case "-1":
            art.dialog
                   ({
                       title: '系统提示',
                       content: ("未找到此分类，请刷新重试！"),
                       lock: true
                   });
            break;
        case "-3":
            art.dialog
                   ({
                       title: '系统提示',
                       content: ("系统错误 请与系统管理员联系！"),
                       lock: true
                   });
            break;
        default:
            $("#txtExtendID").val(json.ShareExtendModel.ID);
            $("#txtExtendScore").val(json.ShareExtendModel.Score);
            $("#txtExtendMoney").val(json.ShareExtendModel.Money);
            $("#txtExtendPocket").val(json.ShareExtendModel.WxPocket);
            $("#txtExtendLimit").val(json.ShareExtendModel.Limit);
            $("#txtExtendLimitValidity").val(json.ShareExtendModel.Validity);
            art.dialog({
                lock: true,
                title: '【推广】奖励修改',
                width: '300',
                content: document.getElementById('ExtendPart'),
                id: 'ExtendPart',
                close: function () { $("#txtExtendScore,#txtExtendMoney,#txtExtendPocket,#txtExtendLimit,#txtExtendLimitValidity").val(""); }
            });
            break;
    }
}
function EditSwitchSuccessShare(json) {
    switch (json) {
        case "0":
            art.dialog
                   ({
                       title: '系统提示',
                       content: ("系统异常，未保存数据，请再次点击保存！"),
                       lock: true
                   });
            break;
        case "-1":
            art.dialog
                   ({
                       title: '系统提示',
                       content: ("未找到此分类，请刷新重试！"),
                       lock: true
                   });
            break;
        case "-3":
            art.dialog
                   ({
                       title: '系统提示',
                       content: ("系统错误 请与系统管理员联系！"),
                       lock: true
                   });
            break;
        default:
            $("#txtShareID").val(json.ShareExtendModel.ID);
            $("#txtShareScore").val(json.ShareExtendModel.Score);
            $("#txtShareMoney").val(json.ShareExtendModel.Money);
            $("#txtSharePocket").val(json.ShareExtendModel.WxPocket);
            $("#txtShareLimit").val(json.ShareExtendModel.Limit);
            $("#txtShareLimitValidity").val(json.ShareExtendModel.Validity);
            art.dialog({
                lock: true,
                title: '【分享】奖励修改',
                width: '300',
                content: document.getElementById('SharePart'),
                id: 'SharePart',
                close: function () { $("#txtShareScore,#txtShareMoney,#txtSharePocket,#txtShareLimit,#txtShareLimitValidity").val(""); }
            });
            break;
    }
}
function EditSwitchSuccessPresent(json) {
    switch (json) {
        case "0":
            art.dialog
                   ({
                       title: '系统提示',
                       content: ("系统异常，未保存数据，请再次点击保存！"),
                       lock: true
                   });
            break;
        case "-1":
            art.dialog
                   ({
                       title: '系统提示',
                       content: ("未找到此分类，请刷新重试！"),
                       lock: true
                   });
            break;
        case "-3":
            art.dialog
                   ({
                       title: '系统提示',
                       content: ("系统错误 请与系统管理员联系！"),
                       lock: true
                   });
            break;
        default:
            $("#txtPresentID").val(json.PresentModel.ID);
            $("#txtPresentName").val(json.PresentModel.PresentsName);
            $("#txtPresentLimit").val(json.PresentModel.Validity);
            art.dialog({
                lock: true,
                title: '【小礼品】奖励修改',
                width: '300',
                content: document.getElementById('PresentPart'),
                id: 'PresentPart',
                close: function () { $("#txtPresentName,#txtPresentLimit").val(""); }
            });
            break;
    }
}


